﻿<%@ Page Title="Include /exclude items" Language="C#" MasterPageFile="~/Demo.master"
    Inherits="DemoPage" StylesheetTheme="start" %>

<%@ Register Src="~/CodeFormatter.ascx" TagName="Code" TagPrefix="demo" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        DataBind();
    }
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="DemoHolder" runat="Server">
    <div class="dna-state-help ui-corner-all" style="margin-bottom: 10px;">
        Specify which items are eligible to sort by passing a jQuery server side selector into the <b>DisableSortableItems</b>
        property. Items excluded from this property are not sortable, nor are they valid targets
        for sortable items.
        <p>
            To only prevent sorting on certain items, pass a jQuery selector into the <b>DisableDraggingElements</b>
            property. Cancelled items remain valid sort targets for others.</p>
    </div>
    <br />
    <style type="text/css">
        .sortable1, .sortable2 { list-style-type: none; margin: 0; padding: 0; zoom: 1; }
        .sortable1 li, .sortable2 li { margin: 0 5px 5px 5px; padding: 3px;padding-left: 1.5em; }
        .sortable1 li span ,.sortable2 li span{ position: absolute; margin-left: -1.3em; }
        .docs { clear: left; font-weight: normal; font-size: 12pt; margin: 0; padding: 0.5em 0 1em; }
    </style>
    <h3 class="docs">
        Cancel sorting (but keep as drop targets):</h3>
    <DotNetAge:SimpleListView ID="SimpleListView1" runat="server" CssClass="ui-helper-reset sortable1">
        <ItemTemplate>
            <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
            <%# Eval("Text") %>
        </ItemTemplate>
        <Items>
            <DotNetAge:SimpleListItem CssClass="ui-state-default" Text="Item 1" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default ui-state-disabled" Text=" (I'm not sortable or a drop target)" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default ui-state-disabled" Text="(I'm not sortable or a drop target)" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default" Text="Item 4" />
        </Items>
    </DotNetAge:SimpleListView>
    <h3 class="docs">
        Cancel sorting (but keep as drop targets):</h3>
        <DotNetAge:SimpleListView ID="SimpleListView2" runat="server" CssClass="ui-helper-reset sortable2">
        <ItemTemplate>
            <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
            <%# Eval("Text") %>
        </ItemTemplate>
        <Items>
            <DotNetAge:SimpleListItem CssClass="ui-state-default" Text="Item 1" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default ui-state-disabled" Text=" (I'm not sortable)" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default ui-state-disabled" Text="(I'm not sortable)" />
            <DotNetAge:SimpleListItem CssClass="ui-state-default" Text="Item 4" />
        </Items>
    </DotNetAge:SimpleListView>
    <DotNetAge:Sortable ID="SortablePlugin1" runat="server">
        <Target TargetID="SimpleListView1" />
        <DisableSortableItems Selector="li:not(.ui-state-disabled)" />
    </DotNetAge:Sortable>
    <DotNetAge:Sortable ID="SortablePlugin2" runat="server">
        <Target TargetID="SimpleListView2" />
        <DisableDraggingElements Selector=".ui-state-disabled" />
    </DotNetAge:Sortable>
    <div style="clear: left; margin-top: 5px;">
    </div>
    <br />
    <demo:Code runat="server" ID="codeView" SourceFile="~/Sortable/Codes/HandlingItems.aspx" />
</asp:Content>
